package com.zh.freechat.domain.user;

/**
 * 文章的状态
 * @Author ZH
 * @Date 20:08 2020/7/14
 */
public enum UserStatus {

    /**
     * 账号未激活
     */
    USER_INACTIVE(0),

    /**
     * 账号已激活
     */
    USER_ACTIVE(1);

    int code;

    UserStatus(int value) {
        this.code = (byte)value;
    }

    public int getCode() {
        return code;
    }

    public static UserStatus toStatus(int value){
        for(UserStatus status : UserStatus.values()) {
            if (status.getCode()==value) {
                return status;
            }
        }
        throw new ClassCastException("未知的Article status");
    }
}
